﻿using System;
using System.Linq;
using System.Windows.Forms;
using System.Windows.Input;



namespace Crm2011.Framework.Connect.Commands
{
    internal class SelectProfileCommand : ICommand
    {
        private readonly ConnectionListView _view;



        public SelectProfileCommand(ConnectionListView view)
        {
            _view = view;
        }



        public void Execute(object view)
        {
            _view.DialogResult = DialogResult.OK;
            _view.Close();
        }



        public bool CanExecute(object parameter)
        {
            return (_view.SelectedItems.Count() == 1);
        }



        public event EventHandler CanExecuteChanged;
    }
}